As stated in the iconr package, any iconographic contents can be modeled with nodes linked together with edges. This tutorial explains how to construct this graph, a geometric graph, in a GIS before using the package. The chapter ‘Dataset’ of the iconr documentation can complete the present tutorial.

Detail of a Late Bronze Age stelae (Solana de Cabañas, Cáceres, Spain). Credits: Museo Arqueológico Nacional, Madrid

GIS offer multiple tools and options to facilitate the data entry. Here, we only look at the most basic ones but also point out the possible short cuts or good practices.

Always start with an image

The image will be the reference space of the graph. So, before anything, start by opening the image decoration into a GIS (for example QGIS), or downloading the training decoration from GitHub

Whether it is not mandatory – and not available in all GIS – you can check the box Non projection (or unknown/non-Earth projection). The projection system will not affect the next step.

The image extent is measured in pixels with a top-left corner origin (0,0).

To retrieve to true scale of the decoration, you can create a scale bar and apply a simple rule of three to convert pixels into centimeters or meters. For example, if the scale belongs to another drawing, you can import it and ‘georeferenced’ it on the original drawing with the Freehand raster georeferencer plugin, and then create the scale bar

To retrieve the real dimensions of each GUs, first get the pixel sizes with the Measure line tools, then apply a simple rule of three with:

Create the attributes dataframes for the graph elements

At first, we have to create the data structures for the nodes and the edges. Like for the decoration image, the coordinates system of the nodes and edges are irrelevant: their coordinates are measured in pixels.

Nodes attributes dataframe

Nodes are created as a shapefile of POINTS. The attribute table of the nodes has at least four (4) fields:

  1. site (Text)
  2. decor (Text)
  3. id (Integer)
  4. a relevant characteristics of each node, like its type (Text)

The nodes are created near the centroids of each different graphical units (GUs). See the Node data part of the incor documentation

Edges attributes dataframe

Edges are created as a shapefile of LINES and the edges table attributes is created in the same way as nodes. Edges attribute table has at least five (5) fields:

  1. site (Text)
  2. decor (Text)
  3. a (Integer)
  4. b (Integer)
  5. type (Text)

See the Edge data part of the incor documentation

Add graph elements

In the GIS, add a node for each GUs and add an edge between two contiguous GUs

Add nodes

Add edges

To understand the typology of the edges (field type), see the Edge types part of the incor documentation

Summary

For the Abela decoration, we have created three (3) nodes (1,2,3) and two (2) edges (1-=-2,1-=-2). We nammed the nodes shapefile nodes.shp and the edges shapefile edges.shp because this is their default name in the incor package

Create the table of decorations

A dataframe, the table of decorations, record the joins between the node dataframe and the edge dataframe. This dataframe could be a .tsv (tabulate separated-values) or .csv (comma separated-values)

The table of decorations has four (4) mandatory fields:

  1. idf (Integer)
  2. site (Text)
  3. decor (Text)
  4. img (Text)

To understand the meaning of these fields, see the Table of decorations part of the incor documentation

Work with the incor package

The latest development version of the incor package and its vignette can be downloaded from GitHub

devtools::install_github("zoometh/iconr", build_vignettes=TRUE)

And load the package

library(iconr)

To start using the package, you have first to locate your working directory. For example:

dataDir <- "C:/Users/supernova/Dropbox/My PC (supernova-pc)/Documents/iconr/docs/tutorial/extdata"

The you can start with the function plot_dec_grph() and specifying the extensions of the nodes and edges data (shp)

# Decoration to be plotted
site <- "Abela"
decor <- "Abela"
# Read nodes, edges, and decorations
nds.df <- read_nds(site, decor, dataDir, format = "shp")
eds.df <- read_eds(site, decor, dataDir, format = "shp")
imgs <- read.table(paste0(dataDir, "/imgs.tsv"),
                   sep="\t", stringsAsFactors = FALSE, header = T)

# Save the plot of nodes and edges with node variable "type" as labels
# in png image format and return the image file name.
plot_dec_grph(nds.df, eds.df, imgs,
              site, decor,
              dir = dataDir,
              nd.var = "type")
Abela stelae

Abela stelae

Summary

Once you record all your dataset (nodes, edges, table of decoration and images), you can use the iconr package